/*
 * @FilePath: \undefinedc:\Users\sxjct\.leetcode\191.位-1-的个数.cpp
 * @Brief: 
 * @Version: 1.0
 * @Date: 2021-03-22 09:44:33
 * @Author: tianyiyi
 * @Copyright: Copyright@tianyiyi
 * @LastEditors: Mr.Tian
 * @LastEditTime: 2021-03-22 09:51:40
 */
/*
 * @lc app=leetcode.cn id=191 lang=cpp
 *
 * [191] 位1的个数
 */

// @lc code=start
class Solution {
public:
    int hammingWeight(uint32_t n) 
    {
        int count = 0 ;
        for(int i = 0 ; i < 32 ;i++)
        {
            if(n & (1 << i))
            {
                count++;
            }
        }
        return count;
    }
};
// @lc code=end

